import { createApp } from "vue";

import ElementPlus from "element-plus";
import "element-plus/dist/index.css";
import * as ElementPlusIconsVue from '@element-plus/icons-vue'

import "@/assets/styles/index.scss";
import { useGlobalComponent } from "@/components/globals";
import { useI18n } from "./locales";

import directive from "./directive"; // directive

import { addDateRange } from "@/utils/app";

import App from "./App.vue";
import store from "./store";
import router from "./router";

// import {setupRouter} from "./permission";
import './permission'; // permission

const app = createApp(App);
app.config.globalProperties.addDateRange = addDateRange;

for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
}

directive(app); // directive
useGlobalComponent(app);

useI18n(app);

app.use(router);
app.use(store);

// setupRouter(app)

app.use(ElementPlus, {
  size: "small", // set element-plus  large、default、small
});

app.mount("#app");
